<?php
declare (strict_types=1);

namespace app\index\controller;

use addons\V4\admin\model\ProductCate;
use app\common\tool\Result;
use think\facade\View;
use think\Response;

use app\common\model\News as NewsModel;

class Classify extends Base
{

    public function index()
    {
        $primary = ProductCate::getCate();
        $cate_id = $this->request->get('cate_id', $primary->isEmpty() ? 0 : $primary[0]['id']);

        View::assign([
            'cate_id' => $cate_id,
            'primary' => $primary
        ]);
        return View::fetch();
    }


    public function getList($pid): Response
    {
        return Result::success('success',ProductCate::getCate($pid));
    }

}

